Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): update rust crate serde_with to v3 #333

Merged
merged 1 commit into from
Feb 13, 2024

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Feb 10, 2024

Mend Renovate

This PR contains the following updates:

Package Type Update Change
serde_with dependencies major >= 1.14.0, < 2 -> >= 3.6.1, < 4

Release Notes

jonasbb/serde_with (serde_with)

v3.6.1: serde_with v3.6.1

Compare Source

Changed
  • Eliminate dependency on serde's "derive" feature by @​dtolnay (#​694)
    This allows parallel compilation of serde and serde_derive which can speed up the wallclock time.
    It requires that downstream crates do not use the "derive" feature either.

v3.6.0: serde_with v3.6.0

Compare Source

Added
  • Add IfIsHumanReadable for conditional implementation by @​irriden (#​690)
    Used to specify different transformations for text-based and binary formats.
  • Add more JsonSchemaAs impls for all Duration* and Timestamp* adaptors by @​swlynch99 (#​685)
Changed
  • Bump MSRV to 1.65, since that is required for the regex dependency.

v3.5.1: serde_with v3.5.1

Compare Source

Fixed
  • The serde_as macro now better detects existing schemars attributes on fields and incorporates them by @​swlynch99 (#​682)
    This avoids errors on existing #[schemars(with = ...)] annotations.

v3.5.0: serde_with v3.5.0

Compare Source

Added
  • Support for schemars integration added by @​swlynch99 (#​666)
    The support uses a new Schema top-level item which implements JsonSchema
    The serde_as macro can now detect schemars usage and emits matching annotations for all fields with serde_as attribute.
    Many types of this crate come already with support for the schemars, but support is not complete and will be extended over time.

v3.4.0: serde_with v3.4.0

Compare Source

  • Lower minimum required serde version to 1.0.152 (#​653)
    Thanks to @​banool for submitting the PR.

    This allows people that have a problem with 1.0.153 to still use serde_with.

  • Add support for core::ops::Bound (#​655)
    Thanks to @​qsantos for submitting the PR.

v3.3.0: serde_with v3.3.0

Compare Source

Added
  • Support the hashbrown type HashMap and HashSet (#​636, #​637)
    Thanks to @​OliverNChalk for raising the issue and submitting a PR.

    This extends the existing support for HashMaps and HashSets to the hashbrown crate v0.14.
    The same conversions as for the std and indexmap types are available, like general support for #[serde_as] and converting it to/from sequences or maps.

Changed
  • Generalize some trait bounds for DeserializeAs implementations

    While working on #​637 it came to light that some of the macros for generating DeserializeAs implementations were not as generic as they could.
    This means they didn't work with custom hasher types, but only the default hashers.
    This has now been fixed and custom hashers should work better, as long as they implement BuildHasher + Default.

  • (internal) Change how features are documented (#​639)

    This change moves the feature documentation into Cargo.toml in a format that can be read by lib.rs.
    It will improve the generated features documentation there.
    The page with all features remains in the guide but is now generated from the Cargo.toml information.

v3.2.0: serde_with v3.2.0

Compare Source

Added
  • Add optional support for indexmap v2 (#​621)
    Support for v1 is already available using the indexmap_1 feature.
    This adds identical support for v2 of indexmap using the indexmap_2 feature.
Changed
  • Bump MSRV to 1.64, since that is required for the indexmap v2 dependency.
Fixed
  • Prevent panics when deserializing i64::MIN using TimestampSeconds<i64> (#​632, #​633)
    Thanks to @​hollmmax for reporting and fixing the issue.

v3.1.0: serde_with v3.1.0

Compare Source

Added
  • Add FromIntoRef and TryFromIntoRef (#​618)
    Thanks to @​oblique for submitting the PR.

    The new types are similar to the existing FromInto and TryFromInto types.
    They behave different during serialization, allowing the removal of the Clone bound on their SerializeAs trait implementation

Changed
  • Improve documentation about cfg-gating serde_as (#​607)
  • Bump MSRV to 1.61 because that is required by the crate cfg_eval.

v3.0.0: serde_with v3.0.0

Compare Source

This breaking release should not impact most users.
It only affects custom character sets used for base64 of which there are no instances of on GitHub.

Changed
  • Upgrade base64 to v0.21 (#​543)
    Thanks to @​jeff-hiner for submitting the PR.

    Remove support for custom character sets.
    This is technically a breaking change.
    A code search on GitHub revealed no instances of anyone using that, and serde_with ships with many predefined character sets.
    The removal means that future base64 upgrade will no longer be breaking changes.

v2.3.3: serde_with v2.3.3

Compare Source

Changed
  • Update syn to v2 and darling to v0.20 (#​578)
    Update proc-macro dependencies.
    This change should have no impact on users, but now uses the same dependency as serde_derive.

v2.3.2: serde_with v2.3.2

Compare Source

Changed
  • Improve the error message when deserializing OneOrMany or PickFirst fails.
    It now includes the original error message for each of the individual variants.
    This is possible by dropping untagged enums as the internal implementations, since they will likely never support this, as these old PRs show serde#2376 and serde#1544.

    The new errors look like:

    OneOrMany could not deserialize any variant:
      One: invalid type: map, expected u32
      Many: invalid type: map, expected a sequence
    
    PickFirst could not deserialize any variant:
      First: invalid type: string "Abc", expected u32
      Second: invalid digit found in string
    
Fixed
  • Specify the correct minimum serde version as dependency. (#​588)
    Thanks to @​nox for submitting a PR.

v2.3.1: serde_with v2.3.1

Compare Source

Fixed
  • Undo the changes to the trait bound for Seq. (#​570, #​571)
    The new implementation caused issues with serialization formats that require the sequence length beforehand.
    It also caused problems, that certain attributes which worked before no longer worked, due to mismatching number of references.

    Thanks to @​stefunctional for reporting and for @​stephaneyfx for providing a test case.

v2.3.0: serde_with v2.3.0

Compare Source

Added
  • Add serde_as compatible versions for the existing duplicate key and value handling. (#​534)
    The new types MapPreventDuplicates, MapFirstKeyWins, SetPreventDuplicates, and SetLastValueWins can replace the existing modules maps_duplicate_key_is_error, maps_first_key_wins, sets_duplicate_value_is_error, and sets_last_value_wins.

  • Added a new KeyValueMap type using the map key as a struct field. (#​341)
    This conversion is useful for maps, where an ID value is the map key, but the ID should become part of a single struct.
    The conversion allows this, by using a special field named $key$.

    This conversion is possible for structs and maps, using the $key$ field.
    Tuples, tuple structs, and sequences are supported by turning the first value into the map key.

    Each of the SimpleStructs

    // Somewhere there is a collection:
    // #[serde_as(as = "KeyValueMap<_>")]
    // Vec<SimpleStruct>,
    
    #[derive(Serialize, Deserialize)]
    struct SimpleStruct {
        b: bool,
        // The field named `$key$` will become the map key
        #[serde(rename = "$key$")]
        id: String,
        i: i32,
    }

    will turn into a JSON snippet like this.

    "id-0000": {
      "b": false,
      "i": 123
    },
Changed
  • Relax the trait bounds of Seq to allow for more custom types. (#​565)
    This extends the support beyond tuples.
Fixed
  • EnumMap passes the human_readable status of the Serializer to more places.
  • Support alloc on targets without target_has_atomic = "ptr". (#​560)
    Thanks to @​vembacher for reporting and fixing the issue.

v2.2.0: serde_with v2.2.0

Compare Source

Added
  • Add new Map and Seq types for converting between maps and tuple lists. (#​527)

    The behavior is not new, but already present using BTreeMap/HashMap or Vec.
    However, the new types Map and Seq are also available on no_std, even without the alloc feature.

Changed
  • Pin the serde_with_macros dependency to the same version as the main crate.
    This simplifies publishing and ensures that always a compatible version is picked.
Fixed
  • serde_with::apply had an issue matching types when invisible token groups where in use (#​538)
    The token groups can stem from macro_rules expansion, but should be treated mostly transparent.
    The old code required a group to match a group, while now groups are silently removed when checking for type patterns.

v2.1.0: serde_with v2.1.0

Compare Source

Added
  • Add new apply attribute to simplify repetitive attributes over many fields.
    Multiple rules and multiple attributes can be provided each.

    #[serde_with::apply(
        Option => #[serde(default)] #[serde(skip_serializing_if = "Option::is_none")],
        Option<bool> => #[serde(rename = "bool")],
    )]
    #[derive(serde::Serialize)]
    struct Data {
        a: Option<String>,
        b: Option<u64>,
        c: Option<String>,
        d: Option<bool>,
    }

    The apply attribute will expand into this, applying the attributs to the matching fields:

    #[derive(serde::Serialize)]
    struct Data {
        #[serde(default)]
        #[serde(skip_serializing_if = "Option::is_none")]
        a: Option<String>,
        #[serde(default)]
        #[serde(skip_serializing_if = "Option::is_none")]
        b: Option<u64>,
        #[serde(default)]
        #[serde(skip_serializing_if = "Option::is_none")]
        c: Option<String>,
        #[serde(default)]
        #[serde(skip_serializing_if = "Option::is_none")]
        #[serde(rename = "bool")]
        d: Option<bool>,
    }

    The attribute supports field matching using many rules, such as _ to apply to all fields and partial generics like Option to match any Option be it Option<String>, Option<bool>, or Option<T>.

Fixed
  • The derive macros SerializeDisplay and DeserializeFromStr now take better care not to use conflicting names for generic values. (#​526)
    All used generics now start with __ to make conflicts with manually written code unlikely.

    Thanks to @​Elrendio for submitting a PR fixing the issue.

v2.0.1: serde_with v2.0.1

Compare Source

Added
  • time added support for the well-known Iso8601 format.
    This extends the existing support of Rfc2822 and Rfc3339.
Changed
  • Warn if serde_as is used on an enum variant.
    Attributes on enum variants were never supported.
    But #[serde(with = "...")] can be added on variants, such that some confusion can occur when migration (#​499).
Note

A cargo bug (cargo#10801) means that upgrading from v1 to v2 may add unnecessary crates to the Cargo.lock file.
A diff of the lock-file makes it seem that serde_with depends on new crates, even though these crates are unused and will not get compiled or linked.
However, tools consuming Cargo.lock or cargo metadata might give wrong results.

v2.0.0: serde_with v2.0.0

Compare Source

Added
  • Make JsonString<T> smarter by allowing nesting serde_as definitions.
    This allows applying custom serialization logic, before the value gets converted into a JSON string.

    // Rust
    #[serde_as(as = "JsonString<Vec<(JsonString, _)>>")]
    value: BTreeMap<[u8; 2], u32>,
    
    // JSON
    {"value":"[[\"[1,2]\",3],[\"[4,5]\",6]]"}
Changed
  • Make #[serde_as] behave more intuitive on Option<T> fields.

    The #[serde_as] macro now detects if a #[serde_as(as = "Option<S>")] is used on a field of type Option<T> and applies #[serde(default)] to the field.
    This restores the ability to deserialize with missing fields and fixes a common annoyance (#​183, #​185, #​311, #​417).
    This is a breaking change, since now deserialization will pass where it did not before and this might be undesired.

    The Option field and transformation are detected by directly matching on the type name.
    These variants are detected as Option.

    • Option
    • std::option::Option, with or without leading ::
    • core::option::Option, with or without leading ::

    If an existing default attribute is detected, the attribute is not applied again.
    This behavior can be suppressed by using #[serde_as(no_default)] or #[serde_as(as = "Option<S>", no_default)].

  • NoneAsEmptyString and string_empty_as_none use a different serialization bound (#​388).

    Both types used AsRef<str> as the serialization bound.
    This is limiting for non-string types like Option<i32>.
    The deserialization often was already more flexible, due to the FromStr bound.

    For most std types this should have little impact, as the types implementing AsRef<str> mostly implement Display, too, such as String, Cow<str>, or Rc<str>.

  • Bump MSRV to 1.60. This is required for the optional dependency feature syntax in cargo.

Removed
  • Remove old module based conversions.

    The newer serde_as based conversions are preferred.

    • seq_display_fromstr: Use DisplayFromStr in combination with your container type:

      #[serde_as(as = "BTreeSet<DisplayFromStr>")]
      addresses: BTreeSet<Ipv4Addr>,
      #[serde_as(as = "Vec<DisplayFromStr>")]
      bools: Vec<bool>,
    • tuple_list_as_map: Use BTreeMap on a Vec of tuples:

      #[serde_as(as = "BTreeMap<_, _>")] // HashMap will also work
      s: Vec<(i32, String)>,
    • map_as_tuple_list can be replaced with #[serde_as(as = "Vec<(_, _)>")].

    • display_fromstr can be replaced with #[serde_as(as = "DisplayFromStr")].

    • bytes_or_string can be replaced with #[serde_as(as = "BytesOrString")].

    • default_on_error can be replaced with #[serde_as(as = "DefaultOnError")].

    • default_on_null can be replaced with #[serde_as(as = "DefaultOnNull")].

    • string_empty_as_none can be replaced with #[serde_as(as = "NoneAsEmptyString")].

    • StringWithSeparator can now only be used in serde_as.
      The definition of the Separator trait and its implementations have been moved to the formats module.

    • json::nested can be replaced with #[serde_as(as = "json::JsonString")].

  • Remove previously deprecated modules.

    • sets_first_value_wins
    • btreemap_as_tuple_list and hashmap_as_tuple_list can be replaced with #[serde_as(as = "Vec<(_, _)>")].

Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate. View repository job log here.

Copy link

openshift-ci bot commented Feb 10, 2024

Hi @renovate[bot]. Thanks for your PR.

I'm waiting for a containers member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@cgwalters
Copy link
Collaborator

/ok-to-test

@cgwalters cgwalters enabled auto-merge February 11, 2024 18:47
@renovate renovate bot force-pushed the renovate/serde_with-3.x branch 5 times, most recently from e964b7b to 021ac9f Compare February 12, 2024 13:34
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@renovate renovate bot force-pushed the renovate/serde_with-3.x branch from 021ac9f to c07a402 Compare February 12, 2024 14:01
@cevich
Copy link
Member

cevich commented Feb 12, 2024

Closing so the new platform-engineering renovate bot can take over.

@cevich cevich closed this Feb 12, 2024
auto-merge was automatically disabled February 12, 2024 16:52

Pull request was closed

@cevich cevich reopened this Feb 13, 2024
@cgwalters cgwalters merged commit c19d87f into main Feb 13, 2024
19 checks passed
@cgwalters cgwalters deleted the renovate/serde_with-3.x branch February 13, 2024 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants